var express = require('express');
var router = express.Router();
//验证通过将，将数据保存到数据库  并响应数据
const userController = require('../controller/user')
//数据校验
const userValidator = require('../validator/user')
//用户登录验证
const auth = require('../middlewarn/auth')

//用户登录
router.post('/user/login',userValidator.login , userController.login);

//用户注册
router.post('/users',userValidator.register,userController.register)

//获取用户信息
router.get('/user',auth, userController.getCurrentUser)


module.exports = router;
